<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of add_sigma_forDT</title>
  <meta name="keywords" content="add_sigma_forDT">
  <meta name="description" content="! this program adds sigma levels/layers and shifted layers to a netcdf file">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">fvcom_prepro</a> &gt; add_sigma_forDT.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>add_sigma_forDT
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>! this program adds sigma levels/layers and shifted layers to a netcdf file</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function add_siglay_forDT(fname) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment">! this program adds sigma levels/layers and shifted layers to a netcdf file 
! so that Datatank can visualize the results.
!</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <span class="comment">%! this program adds sigma levels/layers and shifted layers to a netcdf file</span>
0002 <span class="comment">%! so that Datatank can visualize the results.</span>
0003 <span class="comment">%!</span>
0004 
0005 <a name="_sub0" href="#_subfunctions" class="code">function add_siglay_forDT(fname)</a>
0006 
0007 <span class="keyword">if</span>(~exist(fname))
0008   error([<span class="string">'file: '</span> fname <span class="string">' does not exist'</span>])
0009 <span class="keyword">end</span>;
0010 fprintf(<span class="string">'adding siglay DT stuff to %s\n'</span>,fname);
0011 nc = netcdf(fname,<span class="string">'w'</span>);
0012 
0013 siglay = nc{<span class="string">'siglay'</span>}(:,:);
0014 siglev = nc{<span class="string">'siglev'</span>}(:,:);
0015 [nlay,node] = size(siglay);
0016 [nlev,node] = size(siglev);
0017 fprintf(<span class="string">'siglay dimension is %d\n'</span>,nlay);
0018 fprintf(<span class="string">'siglev dimension is %d\n'</span>,nlev);
0019 
0020 siglayDT = zeros(nlay,1);
0021 siglay2DT = zeros(nlay,1);
0022 siglevDT = zeros(nlev,1);
0023 
0024 <span class="keyword">for</span> i=1:nlev
0025   siglevDT(i) = double(i-1)/double(nlev-1);
0026 <span class="keyword">end</span>;
0027 <span class="keyword">for</span> i=1:nlay
0028   siglayDT(i) = 0.5*(siglevDT(i)+siglevDT(i+1));
0029   siglay2DT(i) = siglevDT(i); 
0030 <span class="keyword">end</span>;
0031 
0032 nc{<span class="string">'siglay_DT'</span>} = ncfloat(<span class="string">'siglay'</span>) ;
0033 nc{<span class="string">'siglay_DT'</span>}.long_name = <span class="string">'siglay_DT'</span>; 
0034 
0035 nc{<span class="string">'siglay_shift_DT'</span>} = ncfloat(<span class="string">'siglay'</span>) ;
0036 nc{<span class="string">'siglay_shift_DT'</span>}.long_name = <span class="string">'siglay_shift_DT'</span>; 
0037 
0038 nc{<span class="string">'siglev_DT'</span>} = ncfloat(<span class="string">'siglev'</span>) ;
0039 nc{<span class="string">'siglev_DT'</span>}.long_name = <span class="string">'siglev_DT'</span>; 
0040 
0041 nc{<span class="string">'siglay_DT'</span>}(:) = siglayDT;
0042 nc{<span class="string">'siglay_shift_DT'</span>}(:) = siglay2DT;
0043 nc{<span class="string">'siglev_DT'</span>}(:) = siglevDT;
0044 
0045 nc = close(nc);
0046 
0047</pre></div>
<hr><address>Generated on Wed 02-Nov-2011 21:58:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>